
package me.ak.sf;

import java.awt.Font;
import me.ak.sf.level.Level;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import resources.Resources;


public class MenuState extends BasicGameState{
    
    public TrueTypeFont titleFont;
    public Image cornerSloth;
    public Image slothCloseup;
    

    @Override
    public int getID() {
        return 0;
    }

    @Override
    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
        titleFont = new TrueTypeFont(new Font("Arial",Font.BOLD, 50), true);
        cornerSloth = Resources.CORNERSLOTH;
        slothCloseup = Resources.SLOTHCLOSEUP;
        
        
        
    }

    @Override
    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
        g.drawImage(cornerSloth, SlothfallGame.WIDTH-cornerSloth.getWidth()+60, 0);
        g.drawImage(slothCloseup.getScaledCopy(0.5f), -75, slothY);

        g.setFont(titleFont);
        g.setColor(Color.white);
        g.drawString("Slothfall", ((SlothfallGame.WIDTH/2)-(titleFont.getWidth("Slothfall")/2)), titleY);
    }
    
    public float titleGlide = 0.75f;
    public float titleY = SlothfallGame.HEIGHT + 20;
    
    public float slothGlide = 0.25f;
    public float slothY = SlothfallGame.HEIGHT + 20;

    @Override
    public void update(GameContainer gc, StateBasedGame sbg, int i) throws SlickException {
        if (titleY > SlothfallGame.HEIGHT/3) {
            titleY -= titleGlide;
            titleGlide /= 1.0019;
        }else {
            if (slothY > 249) {
            slothY -= slothGlide;
            slothGlide /= 1.00015;
        }
        }
    }

}
